<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="liuWarterList">
      <el-table-column label="名称" align="left" prop="asset_name" />
      <el-table-column v-if="assetType === 'component'" label="数量" align="left" prop="qty" />
      <el-table-column label="借至" align="left" prop="assigned_to_name" />
      <el-table-column label="操作" align="left" prop="option" />
      <el-table-column label="下次盘点时间" align="left" prop="expected_checkin_date" />
      <el-table-column label="备注" align="left" prop="notes" />
      <el-table-column v-if="assetType === 'asset'" label="预计归还日期" align="left" prop="expected_checkin_date">
        <template slot-scope="scope">
          <span>{{ scope.row.expected_checkin_date?scope.row.expected_checkin_date:'--' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作时间" align="left" prop="create_datetime">
        <template slot-scope="scope">
          {{ scope.row.create_datetime }}
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>

import { checkHis } from "@/api/vadmin/basic/base";

export default {
  name: "Historylist",
  components: { },
  props: {
    assetType: {
      type: String,
      defalut: ""
    },
    assetId: {
      type: String,
      defalut: ""
    }
  },
  data() {
    return {
      tooShow: null,
      // 遮罩层
      loading: false,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      liuWarterList: []
    };
  },
  created() {
  },
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      checkHis({ option: "audit", asset_id: this.assetId, pageNum: this.queryParams.pageNum, pageSize: this.queryParams.pageSize, asset_type: this.assetType }).then(res => {
        this.liuWarterList = res.data.results;
        this.total = res.data.count;
        this.loading = false;
      });
    }
  }
};
</script>
<style>
</style>
